package com.eupmt.lab3.service;

import com.eupmt.lab3.controllers.IClientController;
import com.eupmt.lab3.controllers.impl.ClientController;
import com.eupmt.lab3.domain.Client;
import com.thoughtworks.xstream.XStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

/**
 *
 * @author sony
 */
@WebService()
public class WSClient {

   /**
    * Web service operation
    */
   @WebMethod(operationName = "getClientById")
   public String getClientById(@WebParam(name = "idClient")
   int idClient) {
//      return "La id introduida és: " + String.valueOf(idClient);
      IClientController clientController = ClientController.getInstance();
      XStream xStream = new XStream();
         Client client = null;
      try {
         client = clientController.getClientById(idClient);
         Logger.getLogger(WSClient.class.getName()).log(Level.INFO, null, client.toString());
      } catch (Exception ex) {
         Logger.getLogger(WSClient.class.getName()).log(Level.SEVERE, null, ex);
      }
         
      return client.toString();
//      return xStream.toXML(client);
   }

}
